<!DOCTYPE HTML>
<html lang="en">
<head>
  <meta name="copyright" content=
  "Copyright (c) IBM Corporation and others 2000, 2009. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page.">
  <meta charset="utf-8">
  <link rel="STYLESHEET" href="../book.css" type="text/css">
  <title>Saving &amp; Reusing Ant Options</title>
</head>
<body>
  <h1>Saving &amp; Reusing Ant Options</h1>
  <p>When we ran the <code>HelloWorld.xml</code> Ant buildfile in the <a href="./qs-84_run_ant.htm">last section</a>,
  the choice of targets, along with all other options in the launch configuration dialog were saved in an entity called
  a 'launch configuration'. Launch configurations contain all details necessary to run an Ant buildfile in a particular
  way. It is perfectly valid to have multiple launch configurations associated with a single Ant buildfile. Therefore,
  in addition to the launch configuration that was created in the last step, specifying that our
  <code>HelloWorld.xml</code> buildfile should execute the targets <code>"Hello"</code> and <code>"World"</code> in
  that order, a second launch configuration could be created for the same buildfile specifying different targets or
  just different ordering. Creating multiple launch configurations in this manner allows you to quickly run your Ant
  buildfile in any configuration by simply specifying the corresponding launch configuration.</p>
  <ol>
    <li>From the Workbench toolbar, select <b>Run &gt; External Tools &gt; Open External Tools Dialog...</b>.</li>
    <li>The External Tools dialog opens and presents a choice of launch configurations to view and edit. The launch
    configuration we created when we ran the <code>HelloWorld.xml</code> buildfile is selected in the tree at the left,
    and the tabs on the right show the options for this launch configuration.<br>
    <br>
    <img src="../images/et_dialog.png" alt="External tools dialog" border="0"><br>
    <br></li>
    <li>At the top of the dialog, change the Name to <code>Hello World</code> and <b>Apply</b> the change.</li>
    <li>In the tree at left, bring up on the context menu on the selected launch configuration and choose
    <b>Duplicate</b>, or select the <b>Duplicate</b> on the toolbar above the tree. A copy of the launch configuration
    for the Hello World buildfile is created, <code>(1)</code> is appended to the name, and the new launch
    configuration is selected in the tree.</li>
    <li>Rename the new configuration to <code>World Hello</code>.</li>
    <li>In the <b>Targets</b> tab, click the <b>Order...</b> button, change the order of the targets so that the
    <code>World</code> target executes first, and <b>Apply</b> the change.</li>
    <li>Click <b>Run</b>.</li>
    <li>As before, the <code>HelloWorld.xml</code> buildfile runs and sends its output to the <b><a href=
    "PLUGINS_ROOT/org.eclipse.jdt.doc.user/reference/views/console/ref-console_view.htm">Console view</a></b>. This
    time however, because the targets were reversed, the output is reversed as well.</li>
    <li>Go back to the External Tools drop down in the toolbar.<br>
    <br>
    <img src="../images/et_dropdown.png" alt="External tools drop-down menu" border="0"><br>
    <br>
    Notice now that there are two entries in the history, one for <code>Hello World</code> and one for <code>World
    Hello</code>. In order to rerun the Ant buildfile so that it outputs <code>Hello World</code>, just select this
    launch configuration in the history. To rerun the launch configuration that outputs <code>World Hello</code>,
    select this configuration in the history.<br>
    <strong>Note</strong>: The history is ordered so that the most frequently run configurations are at the top of the
    drop-down.</li>
  </ol>
  <h3 class="related">Related Tasks</h3><a href="qs-82_create.htm">Creating Ant buildfiles</a><br>
  <a href="qs-83_edit.htm">Editing Ant buildfiles</a><br>
  <a href="qs-84_run_ant.htm">Running Ant buildfiles</a><br>
  <a href="qs-93_project_builder.htm">Creating a project builder Ant buildfile</a><br>
  <a href="qs-92_project_builders.htm">Ant buildfiles as project builders</a><br>
  <a href="qs-94_run_pj.htm">Executing project builders</a><br>
  <a href="qs-95_external_tools.htm">External tools</a><br>
  <a href="qs-96_non_ant_pjs.htm">Non-Ant project builders</a><br>
  <a href="qs-97_standalone_ets.htm">Stand-alone external tools</a>
</body>
</html>
